#pragma once
#include "vn/Event.h"

THREAD_BEGIN

class Door
{
public:
	Door(bool open = false) 
		: m_open(open)
		, m_event(FALSE, open)
	{ }

	void Open()	{
		m_open = true;
		m_event.Set();
	}

	void Close() {
		m_open = false;
		m_event.Reset();
	}

	bool IsOpen() {
		return m_open;
	}

	void Wait()	{
		m_event.Wait();
	}

public:
	bool	m_open;
	Event	m_event;
};

THREAD_END
